package com.huaxinkai.mobile.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import com.huaxinkai.entity.BaseEntity;

/**
 * 微信 access_token类
 * @author liuzh
 * @data 2017年1月1日下午4:51:30
 */
@Entity
@Table(name="access_token")
public class AccessToken extends BaseEntity{
	
	private int id;
	
	private String token;	//微信公众号票据
	
	private int expiresIn;	//有效时长
	
	private Date updateDate = new Date();	//此次票据更新时间
	
	private Date loseEfficacyDate = new Date(new Date().getTime() + 7200*1000);		//票据失效时间
	
	@Id
	@Column(name="id",nullable=false,unique=true)
	/*@GenericGenerator(name="generator",strategy="uuid.hex")
	@GeneratedValue(generator="generator")*/
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	
	@Column(name="token",nullable=false)
	public String getToken() {
		return token;
	}
	public void setToken(String token) {
		this.token = token;
	}
	
	@Column(name="expiresIn",nullable=false)
	public int getExpiresIn() {
		return expiresIn;
	}
	public void setExpiresIn(int expiresIn) {
		this.expiresIn = expiresIn;
	}
	
	@Column(name="updateDate",nullable=false)
	public Date getUpdateDate() {
		return updateDate;
	}
	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}
	
	@Column(name="loseEfficacyDate",nullable=false)
	public Date getLoseEfficacyDate() {
		return loseEfficacyDate;
	}
	public void setLoseEfficacyDate(Date loseEfficacyDate) {
		this.loseEfficacyDate = loseEfficacyDate;
	}
	
	public AccessToken() {
		
	}
	
	@Override
	public String toString() {
		return "AccessToken [id=" + id + ", token=" + token + ", expiresIn=" + expiresIn + ", updateDate=" + updateDate
				+ ", loseEfficacyDate=" + loseEfficacyDate + "]";
	}
	
}
